package com.example.boke.mapper;

import com.example.boke.entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RestController;

/**
 * author 依赖
 */
@Mapper
public interface UserMapper
{

    //注册
    @Insert("insert into user values(null,#{username},#{password},#{nick},#{url})")
    void insert(User user);

    //登录
    @Select("select * from user where username=#{username}")
    User check(String username);


    @Select("select  from user where id=#{id}")
    User checkByID(Integer id);

    //通过账号密码查id
    @Select("select id from user where username=#{username} and password=#{password}")
    Integer selectId(String username, String password);

    //注销用户
    @Delete("delete from user where id=#{id}")
    void deleteLogoff(int id);

    //修改用户信息
    //update myemp set name=#{name},sal=#{sal},job=#{job} where id=#{id}
    @Update("update user set username=#{username},password=#{password},nick=#{nick} where id=#{id}")
    void update(User user);


}
